/*
function normalize(arr) {
    arr = arr.map(function (x) {
          return x[0].toUpperCase() + x.substring(1).toLowerCase();
    });
    console.log(arr);
    return arr;
}
console.log(normalize(['adam', 'LISA', 'barT']));*/

/*
function get_primes(arr) {
    function wtf(x) {
        if (x === 1) return false;
        for (let i = 2; i < x; i++) {
            if (x % i === 0) return false;
        }
        return true;
    }
    arr = arr.filter(wtf);
    return arr;
}
var x, r, arr = [];
for (x = 1; x < 100; x++) {
    arr.push(x);
}
r = get_primes(arr);
console.log(r.toString());
if (r.toString() === [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97].toString()) {
    console.log('测试通过!');
} else {
    console.log('测试失败: ' + r.toString());
}*/

/*
'use strict';

class Animal {
    constructor(name) {
        this.name = name;
    }
}

class Cat extends  Animal {
    constructor(name) {
        super(name);
    }
    say() {
        return "Hello, " + this.name + "!";
    }
}

// 测试:
var kitty = new Cat('Kitty');
var doraemon = new Cat('哆啦A梦');
if ((new Cat('x') instanceof Animal) && kitty && kitty.name === 'Kitty' && kitty.say && typeof kitty.say === 'function' && kitty.say() === 'Hello, Kitty!' && kitty.say === doraemon.say) {
    console.log('测试通过!');
} else {
    console.log('测试失败!');
}*/

/*'use strict';

// 选择<p>JavaScript</p>:
var js = document.getElementById('test-p');

// 选择<p>Python</p>,<p>Ruby</p>,<p>Swift</p>:
var arr = document.getElementsByClassName("c-red c-green");

// 选择<p>Haskell</p>:
var haskell = document.getElementsByClassName("c-green").lastElementChild;

// 测试:
if (!js || js.innerText !== 'JavaScript') {
    alert('选择JavaScript失败!');
} else if (!arr || arr.length !== 3 || !arr[0] || !arr[1] || !arr[2] || arr[0].innerText !== 'Python' || arr[1].innerText !== 'Ruby' || arr[2].innerText !== 'Swift') {
    console.log('选择Python,Ruby,Swift失败!');
} else if (!haskell || haskell.innerText !== 'Haskell') {
    console.log('选择Haskell失败!');
} else {
    console.log('测试通过!');
}*/

